/*
 * B.cpp
 *
 *  Created on: 2013-10-25
 *      Author: zy
 */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	scanf("%d", &n);
	while (n--)
	{
		int k, m;
		scanf("%d%d", &k, &m);
		if(m>k)printf("%f\n",0.0);
		else printf("%f\n", 1 - m * 1.0 / (k + 1));
	}
	return 0;
}

